/**
 * // This is the CustomFunction's API interface.
 * // You should not implement it, or speculate about its implementation
 * function CustomFunction() {
 *     @param {integer, integer} x, y
 *     @return {integer}
 *     this.f = function(x, y) {
 *         ...
 *     };
 * };
 */

/**
 * @param {CustomFunction} customfunction
 * @param {integer} z
 * @return {integer[][]}
 */
 var findSolution = function(customfunction, z) {
    let res = []
    for(let x=1;x<=1000;x++){
      let yleft= 1,yright=1000,ymidle
      while(yleft<=yright){
        ymidle=Math.floor((yleft+yright)/2)
        if(customfunction.f(x,ymidle)==z){
          res.push([x,ymidle])
        }else if(customfunction.f(x,ymidle)>z){
          yright = ymidle-1
        }else {
          yleft=ymidle+1
        }
      }
    }
    return res
};